package Observer;

public class ObserverPatternDemo {
    public static void main(String[] args) {

        Subject subject = new Subject();

        /*
            ① 这里的创建的顺序, 就是我 ObserverList里的顺序. 0-b, 1-o, 2-h
            ② 因为传入的是 同一个 subject 对象, 所以 ObserverList 是 同一个
         */
        new BinaryObserver(subject);
        new OctalObserver(subject);
        new HexaObserver(subject);

        System.out.println("First state is changed to :  15" );
        subject.setState(15);

        System.out.println(" --- --- --- ");
        System.out.println("Second state is changed to :  916" );
        subject.setState(916);
    }
}
